Having issues with field level validation using simple function